// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
// http://www.zhengzhong.net/
//
// $Id: xslt_result.hpp 318 2009-03-02 14:03:21Z heavyzheng $
//

#ifndef ZZHENG_XML_XSLT_LIBXSLT_XSLT_RESULT_HPP_20090206__
#define ZZHENG_XML_XSLT_LIBXSLT_XSLT_RESULT_HPP_20090206__

#include <zzheng/xml/config.hpp>
#include <zzheng/xml/xslt/libxslt/base.hpp>
#include <zzheng/xml/xslt/libxslt/libxslt_fwd.hpp>

#include <boost/shared_ptr.hpp>
#include <string>


namespace zzheng {
namespace xml {
namespace xslt {
namespace libxslt_ {

    class transformer;

    class xslt_result: private base {

        friend class transformer;

    public:

        //! Default constructor.
        explicit xslt_result();

        // Use auto-generated copy constructor.
        // Use auto-generated copy assignment.
        // Use auto-generated destructor.

        //! Checks if the result is good.
        //! \return true if the result is good, false otherwise.
        bool good() const;

        //! Returns a string representation of the XSLT result.
        //! \param str  a string to hold the XSLT result.
        std::string str() const;

        //! Saves the XSLT result to a file.
        //! \param file_name  the file name.
        void save_to_file(const std::string& file_name) const;

    private:

        explicit xslt_result(xmlDoc* doc, const boost::shared_ptr<xsltStylesheet>& stylesheet);

    private:

        boost::shared_ptr<xmlDoc>         doc_;
        boost::shared_ptr<xsltStylesheet> stylesheet_;

    }; // class xslt_result


} // namespace zzheng::xml::xslt::libxslt_
} // namespace zzheng::xml::xslt
} // namespace zzheng::xml
} // namespace zzheng


#endif // ZZHENG_XML_XSLT_LIBXSLT_XSLT_RESULT_HPP_20090206__



